package adapters;

import android.app.Activity;
import android.content.Context;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;

import com.metodo_ahp.usuario.aplicacionmetodoahp.R;

import java.util.List;

import clasesAuxiliares.ItemListaCriterio;
import libreria.WizardStep;
import modelo.Item;

/**
 * Created by Usuario on 28/09/2014.
 */
public class CriterioDefinicionAdapter extends ArrayAdapter{
    Activity context;
    private List<Item> criterios;


    static class ViewHolder {
        public EditText text;
    }

    public CriterioDefinicionAdapter(Context context, int textViewResourceId,List<Item> items){
        super(context, textViewResourceId, items);
        this.criterios = items;
    }


    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View item = convertView;

        if(item == null)
        {
            LayoutInflater inflater = (LayoutInflater) context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            item = inflater.inflate(R.layout.step_1_item_def_criterio, parent, false);
            //Configurar view holder.
            ViewHolder holder = new ViewHolder();
            holder.text = (EditText) item.findViewById(R.id.txtDefCriterioNombre );

            item.setTag(holder);
        }

        //Fill data.
        ViewHolder holder = (ViewHolder) item.getTag();
        holder.text.setText(criterios.get(position).getNombre());

        return item;
    }


}
